<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <title>欢迎</title>
    <script>
        window.onload = function (){
            fetch('/user', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify({})
            })
                .then(response => response.json())
                .then(data => {
                    document.getElementById('username').textContent = data.username
                })
                .catch(error => console.error('Error:', error))
        }
    </script>
</head>
<body>
    <h1>欢迎，<span id="username"></span>！</h1>
    <a href="logout">退出登录</a>
</body>
</html>